<?php

class View {
    private $file_name;
    private $__dict__ = array();

    public function __construct($name){
        $this->file_name = $name.'.php';
    }

    public function __get($nm){
        return $this->__dict__[$nm];
    }

    public function show($variables=array(), $include_head='head', $include_footer='footer'){
        $this->__dict__ = $variables;

        if($include_head && is_file("template/$include_head.php")){
            include("template/$include_head.php");
        }

        require('template/'.$this->file_name);

        if($include_footer && is_file("template/$include_footer.php")){
            include("template/$include_footer.php");
        }
    }
}

?>
